/-app
/-imports
/-storage ...
/-storage/api
/-storage/dom ...
StorageAccess.ts
SyncStorageAccess.ts
/-storage/indexedDB
/-storage/localStorage
/-storage/webSQL
/-typings
functions.ts
index.html
x
1
module teapo.dom {
2
  
3
  export class SyncStorageAccess {
4
​
5
    private _folderCache: { [fullPath: string]: HTMLUListElement; } = {};
6
    private _liCache: { [fullPath: string]: HTMLLIElement; } = {};
7
    
8
    constructor(private _root: HTMLUListElement) {
9
    }
10
    
11
    update(
12
      byFullPath: storage.PropertiesByFullPath,
13
      timestamp: number): void {
14
    }
15
​
16
    read(fullPaths: string[]): storage.PropertiesByFullPath {
17
      return null;
18
    }
19
​
20
    private _getFolder(fullPath: string, createWhenMissing: boolean): HTMLUListElement {
21
      var result = this._folderCache[fullPath];
22
      if (result != null) return result;
23
      
24
      result = this._getFolderNotCached(fullPath, createWhenMissing);
25
      this._folderCache[fullPath] = result;
26
      return result;
27
    }
28
  
29
    private _getFolderNotCached(fullPath: string, createWhenMissing: boolean): HTMLUListElement {
30
      
31
      var lastSlashPos = fullPath.lastIndexOf('/');
32
      if (lastSlashPos === 0) {
33
        if (fullPath == '/')
34
          return this._root;
35
        else
36
          return this._getChildFolder(this._root, fullPath.slice(1), fullPath, createWhenMissing);
37
      }
38
      else {
39
        var parentPath = fullPath.slice(0, lastSlashPos);
40
        var parent = this._getFolder(parentPath, createWhenMissing);
41
        return this._getChildFolder(parent, fullPath.slice(lastSlashPos + 1), fullPath, createWhenMissing);
42
       }
43
    }
44
  
45
    private _getChildFolder(parent: HTMLUListElement, folderName: string, fullPath: string, createWhenMissing: boolean): HTMLUListElement { 
46
      throw new Error('Not implemented.');
47
    }
48
​
49
    private _getChildLI(parent: HTMLUListElement, folderName: string, fullPath: string, createWhenMissing: boolean): HTMLLIElement { 
50
      for (var i = 0; i < parent.children.length; i++) {
51
        var li = parent.children[i];
52
        if (li.tagName.toLowerCase() !== 'li') continue;
53
        
54
      }
55
​
56
      return null;
57
​
58
    }
59
  
60
    private _getEntry(li: HTMLLIElement) { 
61
    }
62
​
63
​
64
  }
65
  
66
}
55:18